\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h}{
\section{C:/Users/Matt/Documents/School/Robotics/zebulon/v2/vision/ext/SIFT/utils.h File Reference}
\label{vision_2ext_2_s_i_f_t_2utils_8h}\index{C:/Users/Matt/Documents/School/Robotics/zebulon/v2/vision/ext/SIFT/utils.h@{C:/Users/Matt/Documents/School/Robotics/zebulon/v2/vision/ext/SIFT/utils.h}}
}
{\ttfamily \#include \char`\"{}cxcore.h\char`\"{}}\par
{\ttfamily \#include $<$stdio.h$>$}\par
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h_a996f7be338ccb40d1a2a5abc1ad61759}{
\#define {\bfseries ABS}(x)~( ( x $<$ 0 )? -\/x : x )}
\label{vision_2ext_2_s_i_f_t_2utils_8h_a996f7be338ccb40d1a2a5abc1ad61759}

\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{vision_2ext_2_s_i_f_t_2utils_8h_a4fee18a5a1805687e67b740843503fd1}{fatal\_\-error} (char $\ast$format,...)
\item 
char $\ast$ \hyperlink{vision_2ext_2_s_i_f_t_2utils_8h_a4ca26220c3dfe8978a1fa0c980606799}{replace\_\-extension} (const char $\ast$file, const char $\ast$extn)
\item 
char $\ast$ \hyperlink{vision_2ext_2_s_i_f_t_2utils_8h_a9f24b850135f5e91700f3234340cc4d1}{basename} (const char $\ast$pathname)
\item 
void \hyperlink{vision_2ext_2_s_i_f_t_2utils_8h_ab55e901874296235af68faf9165d7507}{progress} (int done)
\item 
void \hyperlink{vision_2ext_2_s_i_f_t_2utils_8h_ae7bc65914da62bbab3a02d17beb2c78b}{erase\_\-from\_\-stream} (FILE $\ast$stream, int n)
\item 
int \hyperlink{vision_2ext_2_s_i_f_t_2utils_8h_a68c4dbfd103246f80075a6523a00a14e}{array\_\-double} (void $\ast$$\ast$array, int n, int size)
\item 
double \hyperlink{vision_2ext_2_s_i_f_t_2utils_8h_a3ad1a19568fd7f596f8b21818f08ea50}{dist\_\-sq\_\-2D} (CvPoint2D64f p1, CvPoint2D64f p2)
\item 
void \hyperlink{vision_2ext_2_s_i_f_t_2utils_8h_a52d9d9b5ed7ada25ef5bef84d758d8c5}{draw\_\-x} (IplImage $\ast$img, CvPoint pt, int r, int w, CvScalar color)
\item 
IplImage $\ast$ \hyperlink{vision_2ext_2_s_i_f_t_2utils_8h_a62a43907f02f475f0ca519d7e1eaee6e}{stack\_\-imgs} (IplImage $\ast$img1, IplImage $\ast$img2)
\item 
void \hyperlink{vision_2ext_2_s_i_f_t_2utils_8h_a99b420fa13b30911347fe2cf958c7ca2}{vid\_\-view} (IplImage $\ast$$\ast$imgs, int n, char $\ast$win\_\-name)
\item 
int \hyperlink{vision_2ext_2_s_i_f_t_2utils_8h_a86394d4951bb8b183ad48ec1d59b1690}{win\_\-closed} (char $\ast$name)
\end{DoxyCompactItemize}


\subsection{Detailed Description}
Miscellaneous utility functions.

Copyright (C) 2006 Rob Hess $<$\href{mailto:hess@eecs.oregonstate.edu}{\tt hess@eecs.oregonstate.edu}$>$

\begin{DoxyVersion}{Version}
1.1.1-\/20070913 
\end{DoxyVersion}


\subsection{Function Documentation}
\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h_a68c4dbfd103246f80075a6523a00a14e}{
\index{vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}!array\_\-double@{array\_\-double}}
\index{array\_\-double@{array\_\-double}!vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}}
\subsubsection[{array\_\-double}]{\setlength{\rightskip}{0pt plus 5cm}int array\_\-double (void $\ast$$\ast$ {\em array}, \/  int {\em n}, \/  int {\em size})}}
\label{vision_2ext_2_s_i_f_t_2utils_8h_a68c4dbfd103246f80075a6523a00a14e}
Doubles the size of an array with error checking


\begin{DoxyParams}{Parameters}
\item[{\em array}]pointer to an array whose size is to be doubled \item[{\em n}]number of elements allocated for {\itshape array\/} \item[{\em size}]size in bytes of elements in {\itshape array\/} \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns the new number of elements allocated for {\itshape array\/}. If no memory is available, returns 0 and frees array. 
\end{DoxyReturn}
\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h_a9f24b850135f5e91700f3234340cc4d1}{
\index{vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}!basename@{basename}}
\index{basename@{basename}!vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}}
\subsubsection[{basename}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ basename (const char $\ast$ {\em pathname})}}
\label{vision_2ext_2_s_i_f_t_2utils_8h_a9f24b850135f5e91700f3234340cc4d1}
A function that removes the path from a filename. Similar to the Unix basename command.


\begin{DoxyParams}{Parameters}
\item[{\em pathname}]a (full) path name\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns the basename of {\itshape pathname\/}. 
\end{DoxyReturn}
\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h_a3ad1a19568fd7f596f8b21818f08ea50}{
\index{vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}!dist\_\-sq\_\-2D@{dist\_\-sq\_\-2D}}
\index{dist\_\-sq\_\-2D@{dist\_\-sq\_\-2D}!vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}}
\subsubsection[{dist\_\-sq\_\-2D}]{\setlength{\rightskip}{0pt plus 5cm}double dist\_\-sq\_\-2D (CvPoint2D64f {\em p1}, \/  CvPoint2D64f {\em p2})}}
\label{vision_2ext_2_s_i_f_t_2utils_8h_a3ad1a19568fd7f596f8b21818f08ea50}
Calculates the squared distance between two points.


\begin{DoxyParams}{Parameters}
\item[{\em p1}]a point \item[{\em p2}]another point \end{DoxyParams}
\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h_a52d9d9b5ed7ada25ef5bef84d758d8c5}{
\index{vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}!draw\_\-x@{draw\_\-x}}
\index{draw\_\-x@{draw\_\-x}!vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}}
\subsubsection[{draw\_\-x}]{\setlength{\rightskip}{0pt plus 5cm}void draw\_\-x (IplImage $\ast$ {\em img}, \/  CvPoint {\em pt}, \/  int {\em r}, \/  int {\em w}, \/  CvScalar {\em color})}}
\label{vision_2ext_2_s_i_f_t_2utils_8h_a52d9d9b5ed7ada25ef5bef84d758d8c5}
Draws an x on an image.


\begin{DoxyParams}{Parameters}
\item[{\em img}]an image \item[{\em pt}]the center point of the x \item[{\em r}]the x's radius \item[{\em w}]the x's line weight \item[{\em color}]the color of the x \end{DoxyParams}
\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h_ae7bc65914da62bbab3a02d17beb2c78b}{
\index{vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}!erase\_\-from\_\-stream@{erase\_\-from\_\-stream}}
\index{erase\_\-from\_\-stream@{erase\_\-from\_\-stream}!vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}}
\subsubsection[{erase\_\-from\_\-stream}]{\setlength{\rightskip}{0pt plus 5cm}void erase\_\-from\_\-stream (FILE $\ast$ {\em stream}, \/  int {\em n})}}
\label{vision_2ext_2_s_i_f_t_2utils_8h_ae7bc65914da62bbab3a02d17beb2c78b}
Erases a specified number of characters from a stream.


\begin{DoxyParams}{Parameters}
\item[{\em stream}]the stream from which to erase characters \item[{\em n}]the number of characters to erase \end{DoxyParams}
\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h_a4fee18a5a1805687e67b740843503fd1}{
\index{vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}!fatal\_\-error@{fatal\_\-error}}
\index{fatal\_\-error@{fatal\_\-error}!vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}}
\subsubsection[{fatal\_\-error}]{\setlength{\rightskip}{0pt plus 5cm}void fatal\_\-error (char $\ast$ {\em format}, \/   {\em ...})}}
\label{vision_2ext_2_s_i_f_t_2utils_8h_a4fee18a5a1805687e67b740843503fd1}
Prints an error message and aborts the program. The error message is of the form \char`\"{}Error: ...\char`\"{}, where the ... is specified by the {\itshape format\/} argument


\begin{DoxyParams}{Parameters}
\item[{\em format}]an error message format string (as with {\ttfamily printf(3)}). \end{DoxyParams}
\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h_ab55e901874296235af68faf9165d7507}{
\index{vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}!progress@{progress}}
\index{progress@{progress}!vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}}
\subsubsection[{progress}]{\setlength{\rightskip}{0pt plus 5cm}void progress (int {\em done})}}
\label{vision_2ext_2_s_i_f_t_2utils_8h_ab55e901874296235af68faf9165d7507}
Displays progress in the console with a spinning pinwheel. Every time this function is called, the state of the pinwheel is incremented. The pinwheel has four states that loop indefinitely: '$|$', '/', '-\/', '$\backslash$'.


\begin{DoxyParams}{Parameters}
\item[{\em done}]if 0, this function simply increments the state of the pinwheel; otherwise it prints \char`\"{}done\char`\"{} \end{DoxyParams}
\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h_a4ca26220c3dfe8978a1fa0c980606799}{
\index{vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}!replace\_\-extension@{replace\_\-extension}}
\index{replace\_\-extension@{replace\_\-extension}!vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}}
\subsubsection[{replace\_\-extension}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ replace\_\-extension (const char $\ast$ {\em file}, \/  const char $\ast$ {\em extn})}}
\label{vision_2ext_2_s_i_f_t_2utils_8h_a4ca26220c3dfe8978a1fa0c980606799}
Replaces a file's extension, which is assumed to be everything after the last dot ('.') character.


\begin{DoxyParams}{Parameters}
\item[{\em file}]the name of a file\item[{\em extn}]a new extension for {\itshape file\/}; should not include a dot (i.e. {\ttfamily \char`\"{}jpg\char`\"{}}, not {\ttfamily \char`\"{}.jpg\char`\"{}}) unless the new file extension should contain two dots.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns a new string formed as described above. If {\itshape file\/} does not have an extension, this function simply adds one. 
\end{DoxyReturn}
\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h_a62a43907f02f475f0ca519d7e1eaee6e}{
\index{vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}!stack\_\-imgs@{stack\_\-imgs}}
\index{stack\_\-imgs@{stack\_\-imgs}!vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}}
\subsubsection[{stack\_\-imgs}]{\setlength{\rightskip}{0pt plus 5cm}IplImage$\ast$ stack\_\-imgs (IplImage $\ast$ {\em img1}, \/  IplImage $\ast$ {\em img2})}}
\label{vision_2ext_2_s_i_f_t_2utils_8h_a62a43907f02f475f0ca519d7e1eaee6e}
Combines two images by scacking one on top of the other


\begin{DoxyParams}{Parameters}
\item[{\em img1}]top image \item[{\em img2}]bottom image\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns the image resulting from stacking {\itshape img1\/} on top if {\itshape img2\/} 
\end{DoxyReturn}
\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h_a99b420fa13b30911347fe2cf958c7ca2}{
\index{vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}!vid\_\-view@{vid\_\-view}}
\index{vid\_\-view@{vid\_\-view}!vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}}
\subsubsection[{vid\_\-view}]{\setlength{\rightskip}{0pt plus 5cm}void vid\_\-view (IplImage $\ast$$\ast$ {\em imgs}, \/  int {\em n}, \/  char $\ast$ {\em win\_\-name})}}
\label{vision_2ext_2_s_i_f_t_2utils_8h_a99b420fa13b30911347fe2cf958c7ca2}
Allows user to view an array of images as a video. Keyboard controls are as follows:


\begin{DoxyItemize}
\item Space -\/ start and pause playback 
\item Page Up -\/ skip forward 10 frames 
\item Page Down -\/ jump back 10 frames 
\item Right Arrow -\/ skip forward 1 frame 
\item Left Arrow -\/ jump back 1 frame 
\item Backspace -\/ jump back to beginning 
\item Esc -\/ exit playback 
\item Closing the window also exits playback 
\end{DoxyItemize}


\begin{DoxyParams}{Parameters}
\item[{\em imgs}]an array of images \item[{\em n}]number of images in {\itshape imgs\/} \item[{\em win\_\-name}]name of window in which images are displayed \end{DoxyParams}
\hypertarget{vision_2ext_2_s_i_f_t_2utils_8h_a86394d4951bb8b183ad48ec1d59b1690}{
\index{vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}!win\_\-closed@{win\_\-closed}}
\index{win\_\-closed@{win\_\-closed}!vision/ext/SIFT/utils.h@{vision/ext/SIFT/utils.h}}
\subsubsection[{win\_\-closed}]{\setlength{\rightskip}{0pt plus 5cm}int win\_\-closed (char $\ast$ {\em name})}}
\label{vision_2ext_2_s_i_f_t_2utils_8h_a86394d4951bb8b183ad48ec1d59b1690}
Checks if a HighGUI window is still open or not


\begin{DoxyParams}{Parameters}
\item[{\em name}]the name of the window we're checking\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns 1 if the window named {\itshape name\/} has been closed or 0 otherwise 
\end{DoxyReturn}
